package com.smartstate.autoMaticControl.service.impl;
import java.util.Date;
import java.util.List;

import com.smartstate.autoMaticControl.entity.Dictionary;
import com.smartstate.autoMaticControl.mapper.DictionaryMapper;
import com.smartstate.autoMaticControl.service.DictionaryService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class DictionaryServiceImpl implements DictionaryService {
    @Resource
    private DictionaryMapper dictionaryMapper;

    @Override
    public void add(Dictionary dictionary) {
        Dictionary dictionaryDate = new Dictionary();
        dictionaryDate.setFieldName(dictionary.getFieldName());
        dictionaryDate.setName(dictionary.getName());
        dictionaryDate.setType(dictionary.getType());
        dictionaryDate.setCreateTime(new Date());
        dictionaryDate.setUpdateTime(new Date());
        dictionaryMapper.add(dictionaryDate);
    }

    @Override
    public List<Dictionary> getAll() {
        return dictionaryMapper.getAll();
    }
}
